<%@page pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Travel</title>
<link type="text/css" rel="stylesheet" href="styles/all.css" />
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
	//左侧导航
	$(document).ready(function() {
		var menuList = $('.menuList');
		$('.nav input').each(function(i) {//获取列表的大标题并遍历
			$(this).click(function() {
				if ($(menuList[i]).css('display') == 'none') {
					$(menuList[i]).slideDown(200);
				} else {
					$(menuList[i]).slideUp(200);
				}
			});

		});
	});
	//全选
	function selectAdmins(inputObj) {
		var inputArray = document.getElementById("datalist")
				.getElementsByTagName("input");
		for (var i = 1; i < inputArray.length; i++) {
			if (inputArray[i].type == "checkbox") {
				inputArray[i].checked = inputObj.checked;
			}
		}
	}
	//删除
	function delAdmin() {
		var r = window.confirm("确定要删除此管理员吗？");
		document.getElementById("operate_result_info").style.display = "block";
	}

	$(function() {
		var oldPwd_f = true;
		var newPwd_f = true;
		var confPwd_f = false;
		$("#pwd_old").blur(
				function() {
					$("#pwd_old_span").css("color", "red").css("font-size",
							"12px");
					var userCode = $("#userCode").val();
					var pwd = $(this).val();
					if (pwd == '' || pwd == null) {
						oldPwd_f = false;
						$("#pwd_old_span").text("密码为空");
						return;
					}
					$("#pwd_old_span").load("queryPassword.do",
							"userCode=" + userCode + "&password=" + pwd);
					if ($("#pwd_old_span").text() == "") {
						oldPwd_f = true;
					}
				});

		$("#pwd_new").blur(function() {
			var regxCode = /^[0-9a-zA-Z_]{6,20}$/;
			var value = $(this).val();
			console.log("new Pwd:" + $(this).val());
			if (!regxCode.test(value)) {
				console.log("new Pwd:" + $(this).val());
				newPwd_f = false;
				$("#pwd_new_span").text("账号格式不符");
			} else {
				console.log(" else new Pwd:" + $(this).val());
				newPwd_f = true;
				$("#pwd_new_span").text("");
			}
		});

		$("#pwd_confirm").blur(
				function() {
					var pwd1 = $("#pwd_new").val();
					var pwd2 = $("#pwd_confirm").val();
					if (pwd1 != pwd2) {
						$("#pwd_confirm_span").css("color", "red").css(
								"font-size", "12px").text("两次密码不一致");
						confPwd_f = false;
					} else {
						$("#pwd_confirm_span").text("");
						confPwd_f = true;
					}
				});

		$("#submit").click(function() {
			$("#pwd_old").trigger("blur");
			$("#pwd_new").trigger("blur");
			$("#pwd_confirm").trigger("blur");
			console.log("oldPwd_f:" + oldPwd_f);
			console.log("newPwd_f:" + newPwd_f);
			console.log('confPwd_f:' + confPwd_f);
			console.log(oldPwd_f && newPwd_f && confPwd_f);
			if (oldPwd_f && newPwd_f && confPwd_f) {
				return true;
			}
			return false;
		});
	});
</script>
</head>
<body>
	<!-- logo区 -->
	<div class="logo">
		<img src="img/logo.png" height="90px"> <img src="img/vip.png"
			height="60px" width="50px" class="vip" align="right"
			onclick="location.href='../vip/vip_list.html'"> <img
			src="img/news.png" height="60px" width="45px" class="news"
			align="right" onclick="location.href='../news/news_add.html'">
		<img src="img/firstpage.png" height="60px" width="50px"
			class="firstpage" align="right">
	</div>
	<!-- 小导航区 -->
	<div class="let_nav">
		<ul>
			<c:import url="../let_nav.jsp"></c:import>
		</ul>
	</div>
	<!-- 主要区域 -->
	<div id="main">
		<!-- 导航区 -->
		<div class="nav">
			<c:import url="../nav.jsp"></c:import>
		</div>
	</div>
	<!-- 数据区域 -->
	<div class="data">
		<form action="modifypwd.do" method="post" class="main_form">
			<div class="text_info clearfix">
				<span>帐号：</span>
			</div>
			<div class="input_info">
				<input id="userCode" name="userCode" type="text" readonly class="width300"
					value="${user.u_Code}" />
			</div>
			<div class="text_info clearfix">
				<span>旧密码：</span>
			</div>
			<div class="input_info">
				<input id="pwd_old" type="text" class="width300" value="" /> <span
					id="pwd_old_span"></span>
			</div>
			<div class="text_info clearfix">
				<span>新密码：</span>
			</div>
			<div class="input_info">
				<input id="pwd_new" type="text" name="password" class="width300" value="" />
				<span id="pwd_new_span"></span>
				<div class="validate_msg_short">6-20长度的字母、数字、汉字和下划线的组合</div>
			</div>
			<div class="text_info clearfix">
				<span>确认密码：</span>
			</div>
			<div class="input_info">
				<input id="pwd_confirm" type="text" class="width300" value="" /> <span
					id="pwd_confirm_span"></span>
			</div>
			<div id="submit" class="button_info clearfix">
				<input type="submit" value="保存" class="btn_save">
			</div>

		</form>
	</div>
	<!-- 版权区 -->
	<div class="copy">
		<p>版权所有，违者必究</p>
	</div>
</body>
</html>